/**
 * @author peter.zheng
 */
/*工厂模式的应用*/
var Ajax_loading_a=function(containor,loading_text){
	this.loading_text=loading_text;
	this.createDiv=document.createElement("div");
	this.$_contaionr=$(containor);
	this.isCenter=false;
};
Ajax_loading_a.prototype={
	create:function(){
		
		 var hasLoading=this.$_contaionr.find('.app_ajax_a');
		
		 if(hasLoading){
		 	this.$_contaionr.find('.app_ajax_a').remove();
		 }
		
	     $(this.createDiv).addClass("app_ajax_a");
		 $(this.createDiv).html(this.loading_text);
		 this.$_contaionr.append($(this.createDiv));
		 if(this.isCenter){
		      $(this.createDiv).css("float","left");
			  var _loading_width=$(this.createDiv).outerWidth();
			  var _loading_parent_width=$(this.createDiv).parent().outerWidth(false);
			   $(this.createDiv).css("float","none");
			   var _loading_marginLeft=(_loading_parent_width-_loading_width)*0.5+"px";
			   $(this.createDiv).css("margin-left",_loading_marginLeft)
		 }
	},
	remove:function(){
		$(this.createDiv).remove();
	}
	
}
